package mdocejb.servlet;

import java.io.IOException;

import javax.ejb.EJB;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import sessionBeans.Interfaces.IGestContactGroupRemote;

/**
 * Servlet implementation class LoadGroups
 */
public class LoadGroups extends HttpServlet {
	private static final long serialVersionUID = 1L;

	@EJB(name = "GestContactGroupEntity")
	private IGestContactGroupRemote GCGR; 
	
	/**
	 * @see HttpServlet#HttpServlet()
	 */
	public LoadGroups() {
		super();
		// TODO Auto-generated constructor stub
	}

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		ServletContext ctx = getServletContext();

			ctx.setAttribute("ContactGroups", GCGR.findAll());
			response.sendRedirect("manageGroups.jsp");

	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

}
